function [trainingset testset] = combineSets(Sets, trainfraction, RndSeed)

fn = fieldnames(Sets);

    for n = 1:length(fn),
        %get the train and test set from the current Matrix
       [train test] = sampleSet(Sets.(fn{n}), trainfraction, RndSeed);

       %create a numerical label for the sets
       trainlabel = zeros(length(train),length(fn));
       trainlabel(:,n) = trainlabel(:,n)+1;
       testlabel = zeros(length(test),length(fn));
       testlabel(:,n) = testlabel(:,n)+1;

       %append the new sets
       if n == 1,
            trainingset = [train, trainlabel];
            testset = [test, testlabel];
       else
            trainingset = [trainingset ; [train, trainlabel]];
            testset = [testset ; [test, testlabel]];       
       end

    end
    
    %randomize the two sets
    stream = RandStream('mt19937ar', 'Seed', RndSeed);
    tmpIndices = randperm(stream,length(trainingset));
    trainingset = trainingset(tmpIndices, :);
    tmpIndices = randperm(stream,length(testset));
    testset = testset(tmpIndices, :);
end